package com.zzyl.nursing.controller.member;

import cn.hutool.core.bean.BeanUtil;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.dto.MemberNursingProjectDTO;
import com.zzyl.nursing.domain.po.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: zhaojh
 * @Date: 2025/6/4 - 06 - 04 - 9:04
 * @Description: com.zzyl.nursing.controller.member
 * @version: 1.0
 */
@RestController
@RequestMapping("/member/orders/project")
@Api("预约护理项目")
public class MemberNursingProjectController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询护理项目")
    public TableDataInfo<List<NursingProject>> list(@ApiParam("护理项目查询条件") NursingProject nursingProject)
    {
        startPage();
//        NursingProject nursingProject = new NursingProject();
//        BeanUtil.copyProperties(memberNursingProjectDTO,nursingProject);
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

    @ApiOperation("根据编号查询护理项目信息")
    @GetMapping("/{id}")
    public R<NursingProject> getById(@PathVariable("id") Integer id){
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(Long.valueOf(id));
        return R.ok(nursingProject);
    }
}
